/**
 * Created by Administrator on 2018/1/25.
 */
$(function(){
    var path = window.location.pathname;

    $('.sidebar-toggle').click(function(){
        $('body').toggleClass('is-open');
    });
    $('.search-box>i').click(function(){
        $('.input-group').parent().toggleClass('hide');
    });
   //左侧菜单
    console.log(path);//  /app01/project
    updateMenu();

    $('.sidebar-menu li').click(function(){
        var href = $(this).find('a').attr('href');
        $(this).addClass('selected-item').siblings().removeClass('selected-item');
    });


    function updateMenu(){
        var len = $('.sidebar-menu li').length;
        var href = '';
        for(var i = 0;i<len;i++){
            href = $('.sidebar-menu li').eq(i).find('a').attr('href');
            if(path.match(href)){//找到了
                console.log(href);
                $('.sidebar-menu li').eq(i).addClass('selected-item').siblings().removeClass('selected-item');
                break;
            }
        }
    }
});